
// 时间显示
function updateTime() {
    const now = new Date();
    document.getElementById('showTime').textContent =
        now.toLocaleString('zh-CN', {
            year: 'numeric',
            month: 'long',
            day: 'numeric',
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit',
            hour12: false
        });
}
setInterval(updateTime, 1000);
updateTime();

// 省份中心经纬度映射
const provinceCenters = {
    "北京": [116.4074, 39.9042],
    "天津": [117.1901, 39.1255],
    "上海": [121.4737, 31.2304],
    "重庆": [106.504962, 29.533155],
    "河北": [114.502461, 38.045474],
    "山西": [112.549248, 37.857014],
    "内蒙古": [111.670801, 40.818311],
    "辽宁": [123.429096, 41.796767],
    "吉林": [125.3245, 43.886841],
    "黑龙江": [126.642464, 45.756967],
    "江苏": [118.767413, 32.041544],
    "浙江": [120.153576, 30.287459],
    "安徽": [117.283042, 31.86119],
    "福建": [119.306239, 26.075302],
    "江西": [115.892151, 28.676493],
    "山东": [117.000923, 36.675807],
    "河南": [113.665412, 34.757975],
    "湖北": [114.298572, 30.584355],
    "湖南": [112.982279, 28.19409],
    "广东": [113.280637, 23.125178],
    "广西": [108.320004, 22.82402],
    "海南": [110.33119, 20.031971],
    "四川": [104.065735, 30.659462],
    "贵州": [106.713478, 26.578343],
    "云南": [102.712251, 25.040609],
    "西藏": [91.132212, 29.660361],
    "陕西": [108.948024, 34.263161],
    "甘肃": [103.823557, 36.058039],
    "青海": [101.778916, 36.623178],
    "宁夏": [106.278179, 38.46637],
    "新疆": [87.617733, 43.792818],
    "台湾": [121.509062, 25.044332],
    "香港": [114.173355, 22.320048],
    "澳门": [113.54909, 22.198951]
};

// 模拟美食数据（扩展了更多省份）
const cuisineData =
    {
        "河北": {
            "cuisine": "冀菜",
            "dishes": [
                { name: "驴肉火烧", image: "https://example.com/lvrouhuoshao.jpg" },
                { name: "金毛狮子鱼", image: "https://example.com/jinmaoshiziyu.jpg" },
                { name: "白玉鸡脯", image: "https://tse3-mm.cn.bing.net/th/id/OIP-C.7FMQ9ZAsnXwxRI06PafqVQHaEK?w=303&h=180&c=7&r=0&o=7&dpr=1.3&pid=1.7&rm=3" }
            ],
            "description": "冀菜以咸鲜为主，注重刀工和火候，擅长炖、焖、煨等技法，尤其擅长烹制淡水鱼和宫廷菜。",
            "image": "https://example.com/hebei_food.jpg"
        },
        "山西": {
            "cuisine": "晋菜",
            "dishes": ["刀削面", "过油肉", "平遥牛肉"],
            "description": "晋菜以面食和醋闻名，口味偏咸鲜，擅长炒、炖、熘等技法，融合了北方游牧民族与中原饮食文化。",
            "image": "https://example.com/shanxi_food.jpg"
        },
        "吉林": {
            "cuisine": "吉菜",
            "dishes": ["锅包肉", "朝鲜冷面", "清蒸松花江白鱼"],
            "description": "吉菜融合了满族、朝鲜族等民族特色，口味咸甜适中，注重炖、烧、烤，善用山珍野味。",
            "image": "https://example.com/jilin_food.jpg"
        },
        "辽宁": {
            "cuisine": "辽菜",
            "dishes": ["老边饺子", "沟帮子熏鸡", "葱烧辽参"],
            "description": "辽菜醇厚香浓，擅长扒、熘、爆等技法，融合了宫廷菜、鲁菜和少数民族风味，以海鲜和肉类为主。",
            "image": "https://example.com/liaoning_food.jpg"
        },
        "黑龙江": {
            "cuisine": "龙江菜",
            "dishes": ["哈尔滨红肠", "得莫利炖鱼", "锅包肉"],
            "description": "龙江菜以炖菜和烧烤为主，口味偏重，融合了鲁菜、西餐和少数民族风味，注重食材的原汁原味。",
            "image": "https://example.com/heilongjiang_food.jpg"
        },
        "陕西": {
            "cuisine": "陕菜",
            "dishes": ["肉夹馍", "羊肉泡馍", "凉皮"],
            "description": "陕菜以面食和小吃为主，口味酸辣，擅长煮、蒸、烙等技法，具有浓郁的西北风味。",
            "image": "https://example.com/shaanxi_food.jpg"
        },
        "甘肃": {
            "cuisine": "陇菜",
            "dishes": ["兰州拉面", "手抓羊肉", "酿皮子"],
            "description": "陇菜以面食和牛羊肉为主，口味偏重香辣，擅长煮、炖、烤，融合了回族和汉族饮食特色。",
            "image": "https://example.com/gansu_food.jpg"
        },
        "青海": {
            "cuisine": "青海菜",
            "dishes": ["青海老酸奶", "手抓羊肉", "糌粑"],
            "description": "青海菜以牛羊肉和奶制品为主，口味咸鲜，融合了藏族、回族等民族特色，注重炖煮和烤制。",
            "image": "https://example.com/qinghai_food.jpg"
        },
        "山东": {
            "cuisine": "鲁菜",
            "dishes": ["九转大肠", "葱烧海参", "德州扒鸡"],
            "description": "鲁菜为中国四大菜系之一，注重刀工和火候，口味咸鲜，擅长爆、烧、炸等技法。",
            "image": "https://example.com/shandong_food.jpg"
        },
        "福建": {
            "cuisine": "闽菜",
            "dishes": ["佛跳墙", "荔枝肉", "土笋冻"],
            "description": "闽菜以海鲜和汤类闻名，口味清淡鲜美，擅长炖、蒸、炒等技法，融合了闽南和客家风味。",
            "image": "https://example.com/fujian_food.jpg"
        },
        "浙江": {
            "cuisine": "浙菜",
            "dishes": ["东坡肉", "西湖醋鱼", "龙井虾仁"],
            "description": "浙菜为中国八大菜系之一，口味鲜嫩、醇和，擅长炒、炸、烩等技法，以江南水乡风味为特色。",
            "image": "https://example.com/zhejiang_food.jpg"
        },
        "台湾": {
            "cuisine": "台菜",
            "dishes": ["卤肉饭", "蚵仔煎", "三杯鸡"],
            "description": "台菜融合了闽菜、客家菜和原住民风味，口味多样，注重酱油和糖的使用，擅长炒、炖、烤。",
            "image": "https://example.com/taiwan_food.jpg"
        },
        "河南": {
            "cuisine": "豫菜",
            "dishes": ["黄河大鲤鱼", "烩面", "洛阳水席"],
            "description": "豫菜以汤菜为主，口味鲜香，擅长扒、烧、爆等技法，具有深厚的中原文化底蕴。",
            "image": "https://example.com/henan_food.jpg"
        },
        "湖北": {
            "cuisine": "鄂菜",
            "dishes": ["武昌鱼", "热干面", "排骨藕汤"],
            "description": "鄂菜以水产为本，鱼馔为主，口味以鲜、醇、香、嫩、滑、爽、软著称。",
            "image": "https://example.com/hubei_food.jpg"
        },
        "湖南": {
            "cuisine": "湘菜",
            "dishes": ["剁椒鱼头", "臭豆腐", "辣椒炒肉"],
            "description": "湘菜为中国八大菜系之一，口味香辣，擅长煨、炖、腊等技法，以浓郁的地方特色闻名。",
            "image": "https://example.com/hunan_food.jpg"
        },
        "江西": {
            "cuisine": "赣菜",
            "dishes": ["瓦罐汤", "三杯鸡", "粉蒸肉"],
            "description": "赣菜以咸鲜为主，注重原汁原味，擅长烧、炖、蒸等技法，融合了江南水乡和山区风味。",
            "image": "https://example.com/jiangxi_food.jpg"
        },
        "江苏": {
            "cuisine": "苏菜",
            "dishes": ["松鼠桂鱼", "狮子头", "阳澄湖大闸蟹"],
            "description": "苏菜为中国四大菜系之一，口味清淡，擅长炖、焖、煨等技法，以精细的刀工和造型著称。",
            "image": "https://example.com/jiangsu_food.jpg"
        },
        "安徽": {
            "cuisine": "徽菜",
            "dishes": ["臭鳜鱼", "毛豆腐", "李鸿章大杂烩"],
            "description": "徽菜为中国八大菜系之一，口味咸鲜，擅长烧、炖、蒸等技法，注重火候和腌制工艺。",
            "image": "https://example.com/anhui_food.jpg"
        },
        "广东": {
            "cuisine": "粤菜",
            "dishes": ["白切鸡", "烧鹅", "肠粉"],
            "description": "粤菜为中国四大菜系之一，口味清淡鲜美，擅长煎、炒、蒸、炖等技法，融合了中西饮食文化。",
            "image": "https://example.com/guangdong_food.jpg"
        },
        "海南": {
            "cuisine": "琼菜",
            "dishes": ["文昌鸡", "海南粉", "糟粕醋火锅"],
            "description": "琼菜以海鲜和禽类为主，口味清淡，融合了闽菜和东南亚风味，擅长炖、蒸、炒。",
            "image": "https://example.com/hainan_food.jpg"
        },
        "四川": {
            "cuisine": "川菜",
            "dishes": ["麻婆豆腐", "回锅肉", "火锅"],
            "description": "川菜为中国八大菜系之一，口味麻辣鲜香，擅长炒、爆、熘等技法，以丰富的味型和调料著称。",
            "image": "https://example.com/sichuan_food.jpg"
        },
        "贵州": {
            "cuisine": "黔菜",
            "dishes": ["酸汤鱼", "丝娃娃", "老干妈风味鸡"],
            "description": "黔菜以酸辣为主，注重发酵食材，擅长炖、烧、蒸等技法，融合了苗族、侗族等民族特色。",
            "image": "https://example.com/guizhou_food.jpg"
        },
        "云南": {
            "cuisine": "滇菜",
            "dishes": ["过桥米线", "汽锅鸡", "宣威火腿"],
            "description": "滇菜融合了多民族特色，口味多样，擅长蒸、炖、烤等技法，以丰富的野生菌和香料为特色。",
            "image": "https://example.com/yunnan_food.jpg"
        },
        "内蒙古": {
            "cuisine": "蒙餐",
            "dishes": ["手把肉", "烤全羊", "奶茶"],
            "description": "蒙餐以牛羊肉和奶制品为主，口味咸香，注重烤制和炖煮，具有浓郁的草原风味。",
            "image": "https://example.com/neimenggu_food.jpg"
        },
        "广西": {
            "cuisine": "桂菜",
            "dishes": ["桂林米粉", "柳州螺蛳粉", "荔浦芋扣肉"],
            "description": "桂菜以酸辣和鲜香为主，融合了壮族、侗族等民族特色，擅长炖、蒸、炒，以山水食材为特色。",
            "image": "https://example.com/guangxi_food.jpg"
        },
        "西藏": {
            "cuisine": "藏餐",
            "dishes": ["糌粑", "酥油茶", "风干牦牛肉"],
            "description": "藏餐以牛羊肉和奶制品为主，口味偏重，融合了藏族传统烹饪方法，注重高热量和滋补。",
            "image": "https://example.com/xizang_food.jpg"
        },
        "宁夏": {
            "cuisine": "宁菜",
            "dishes": ["手抓羊肉", "羊杂碎", "宁夏凉皮"],
            "description": "宁菜以牛羊肉为主，口味咸鲜，融合了回族和汉族特色，擅长煮、炖、烤，以酸辣和香料为特色。",
            "image": "https://example.com/ningxia_food.jpg"
        },
        "新疆": {
            "cuisine": "新疆菜",
            "dishes": ["大盘鸡", "烤羊肉串", "手抓饭"],
            "description": "新疆菜以牛羊肉和面食为主，口味香辣，擅长烤、炖、炒等技法，融合了中亚和西域风味。",
            "image": "https://example.com/xinjiang_food.jpg"
        },
        "北京": {
            "cuisine": "京菜",
            "dishes": ["北京烤鸭", "炸酱面", "涮羊肉"],
            "description": "京菜融合了宫廷菜和民间菜，口味醇厚，擅长烤、爆、烧等技法，以精致的刀工和调料著称。",
            "image": "https://example.com/beijing_food.jpg"
        },
        "天津": {
            "cuisine": "津菜",
            "dishes": ["狗不理包子", "十八街麻花", "煎饼果子"],
            "description": "津菜以海鲜和面食为主，口味咸鲜，擅长煎、炒、爆等技法，具有浓郁的市井风味。",
            "image": "https://example.com/tianjin_food.jpg"
        },
        "上海": {
            "cuisine": "沪菜",
            "dishes": ["红烧肉", "小笼包", "生煎包"],
            "description": "沪菜口味浓油赤酱，偏甜，擅长炖、焖、煨等技法，以本帮菜和海派风味为特色。",
            "image": "https://example.com/shanghai_food.jpg"
        },
        "重庆": {
            "cuisine": "渝菜",
            "dishes": ["重庆火锅", "辣子鸡", "毛血旺"],
            "description": "渝菜为川菜分支，口味麻辣鲜香，擅长炒、爆、烧等技法，以火锅和江湖菜闻名。",
            "image": "https://example.com/chongqing_food.jpg"
        },
        "香港": {
            "cuisine": "港式粤菜",
            "dishes": ["烧腊", "虾饺", "云吞面"],
            "description": "港式粤菜融合了西方元素，口味清淡鲜美，擅长蒸、煎、炸等技法，以精致的点心和烧味著称。",
            "image": "https://example.com/hongkong_food.jpg"
        },
        "澳门": {
            "cuisine": "澳菜",
            "dishes": ["葡式蛋挞", "马介休球", "澳门烧肉"],
            "description": "澳菜融合了中葡饮食文化，口味多样，擅长烤、焗、炖等技法，以独特的香料和烹饪方式为特色。",
            "image": "https://example.com/macao_food.jpg"
        }

    };

// 全局变量存储地图实例
let myChart = null;
let baiduMap = null;

// 侧边信息框元素
const leftInfo = document.getElementById('leftInfo');
const rightInfo = document.getElementById('rightInfo');
const mask = document.getElementById('mask');
const closeLeft = document.getElementById('closeLeft');
const closeRight = document.getElementById('closeRight');
const leftContent = document.getElementById('leftContent');
const rightContent = document.getElementById('rightContent');
const infoTitle = document.getElementById('infoTitle');
const rightInfoTitle = document.getElementById('rightInfoTitle');
const provinceDishes = document.getElementById('provinceDishes');

// 初始化ECharts地图（已修改标签显示逻辑，显示所有省份名称）
function initMap() {
    myChart = echarts.init(document.getElementById('chinaMap'));
    // 模拟数据
    function randomData() {
        return Math.round(Math.random() * 500 + 300);
    }
    const mydata = Object.keys(provinceCenters).map(province => ({
        name: province,
        value: randomData()
    }));
    const option = {
        title: {
            text: '中国美食分布',
            subtext: '数据来源：中国餐饮协会 (2023)',
            textStyle: {
                color: '#333',
                fontSize: 22
            },
            subtextStyle: {
                color: '#ff8c00',
                fontSize: 14
            },
            left: 'center',
            top: 10
        },
        tooltip: {
            trigger: 'item',
            backgroundColor: 'rgba(255, 235, 205, 0.9)',
            borderColor: '#ff8c00',
            textStyle: {
                color: '#333'
            },
            formatter: function (params) {
                const province = params.name;
                const info = cuisineData[province];
                if (info) {
                    return `<b>${province}</b><br/>
                    菜系: ${info.cuisine}<br/>
                    代表菜: ${info.dishes.join('、')}<br/>
                    <small>${info.description}</small>`;
                }
                return `<b>${province}</b><br/>点击查看详细信息`;
            }
        },
        visualMap: {
            min: 300,
            max: 800,
            text: ['高', '低'],
            realtime: false,
            calculable: true,
            inRange: {
                color: ['#ffebcd', '#ffdab9', '#ffa07a', '#ff7f50', '#ff6347']
            },
            textStyle: {
                color: '#333'
            }
        },
        series: [{
            name: '美食热度',
            type: 'map',
            map: 'china',
            roam: true,
            label: {
                show: true,
                color: '#333',
                fontSize: 10,
                // 移除省份标签显示限制，显示所有名称
                formatter: function (params) {
                    return params.name;
                }
            },
            emphasis: {
                label: {
                    color: '#333',
                    fontSize: 12
                },
                itemStyle: {
                    areaColor: '#ff8c00'
                }
            },
            itemStyle: {
                areaColor: '#ffebcd',
                borderColor: '#ff8c00',
                borderWidth: 1
            },
            data: mydata,
            // 控制南海诸岛显示
            mapLocation: {
                y: 'bottom'
            },
            selectedMode: 'single'
        }]
    };
    myChart.setOption(option);
    // 添加点击事件监听器
    myChart.on('click', function (params) {
        const province = params.name;
        if (cuisineData[province]) {
            showProvinceInfo(province);
        }
    });
}
// 显示菜品图片
function showDishImage(imageUrl) {
    const dishImage = document.createElement('img');
    dishImage.src = imageUrl;
    dishImage.alt = '菜品图片';
    dishImage.style.maxWidth = '100%';
    dishImage.style.maxHeight = '100%';

    const imageModal = document.createElement('div');
    imageModal.classList.add('image-modal');
    imageModal.appendChild(dishImage);

    document.body.appendChild(imageModal);

    // 点击模态框关闭
    imageModal.addEventListener('click', function () {
        document.body.removeChild(imageModal);
    });
}
// 显示省份信息
function showProvinceInfo(province) {
    const info = cuisineData[province];
    if (!info) return;
    console.log(info.cuisine);
    // 填充左侧信息框内容
    infoTitle.textContent = `${province} - ${info.cuisine}`;
    leftContent.innerHTML = `
                <div class="province-cuisine">
                    <div class="cuisine-name">菜系介绍</div>
                    <p class="province-desc">${info.description}</p>
                    <div class="cuisine-name">代表菜品</div>
                    <ul class="dish-list">
                        ${info.dishes.map(dish => `<li>${dish.name}</li>`).join('')}
                    </ul>
                    <button onclick="showBaiduMap('${province}')">查看百度地图</button>
                </div>
            `;

    // 填充右侧信息框内容（菜品图片）
    rightInfoTitle.textContent = `${province}代表菜品`;
    provinceDishes.innerHTML = `
                <img src="${info.image}" alt="${province}美食" class="dish-image" style="grid-column: 1 / -1;">
                ${info.dishes.map(dish => `
                    <div style="text-align: center; padding: 10px; color: #ff8c00; cursor: pointer;" onclick="showDishImage('${dish.image}')">${dish.name}</div>
                `).join('')}
            `;

    // 显示侧边信息框和遮罩层
    leftInfo.classList.add('show');
    rightInfo.classList.add('show');
    mask.classList.add('show');
}

// 关闭侧边信息框
function closeInfoBoxes() {
    leftInfo.classList.remove('show');
    rightInfo.classList.remove('show');
    mask.classList.remove('show');
}

// 初始化图表（已适配新色调）
function initCharts() {
    // 柱状图
    const barChart = echarts.init(document.getElementById('barChart'));
    const barOption = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            data: ['川菜', '粤菜', '鲁菜', '苏菜', '浙菜', '湘菜'],
            axisLine: {
                lineStyle: {
                    color: '#333'
                }
            }
        },
        yAxis: {
            type: 'value',
            axisLine: {
                lineStyle: {
                    color: '#333'
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(51, 51, 51, 0.1)'
                }
            }
        },
        series: [{
            name: '销量',
            type: 'bar',
            data: [2450, 1890, 1680, 1560, 1420, 1350],
            itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                    { offset: 0, color: '#ff8c00' },
                    { offset: 1, color: '#ff6347' }
                ])
            }
        }]
    };
    barChart.setOption(barOption);

    // 折线图
    const lineChart = echarts.init(document.getElementById('lineChart'));
    const lineOption = {
        tooltip: {
            trigger: 'axis'
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月'],
            axisLine: {
                lineStyle: {
                    color: '#333'
                }
            }
        },
        yAxis: {
            type: 'value',
            axisLine: {
                lineStyle: {
                    color: '#333'
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(51, 51, 51, 0.1)'
                }
            }
        },
        series: [
            {
                name: '火锅类',
                type: 'line',
                stack: '总量',
                data: [120, 132, 101, 134, 90, 230, 210],
                smooth: true,
                lineStyle: {
                    color: '#ff8c00',
                    width: 3
                }
            },
            {
                name: '小吃类',
                type: 'line',
                stack: '总量',
                data: [220, 182, 191, 234, 290, 330, 310],
                smooth: true,
                lineStyle: {
                    color: '#f72585',
                    width: 3
                }
            }
        ]
    };
    lineChart.setOption(lineOption);

    // 饼图
    const pieChart = echarts.init(document.getElementById('pieChart'));
    const pieOption = {
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            right: 10,
            top: 'center',
            textStyle: {
                color: '#333'
            }
        },
        series: [
            {
                name: '菜系占比',
                type: 'pie',
                radius: ['40%', '70%'],
                avoidLabelOverlap: false,
                itemStyle: {
                    borderRadius: 10,
                    borderColor: '#ffebcd',
                    borderWidth: 2
                },
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '18',
                        fontWeight: 'bold',
                        color: '#ff8c00'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    { value: 28.5, name: '川菜', itemStyle: { color: '#f72585' } },
                    { value: 22.3, name: '粤菜', itemStyle: { color: '#7209b7' } },
                    { value: 18.7, name: '鲁菜', itemStyle: { color: '#3a0ca3' } },
                    { value: 15.2, name: '苏菜', itemStyle: { color: '#4361ee' } },
                    { value: 10.8, name: '浙菜', itemStyle: { color: '#4cc9f0' } },
                    { value: 4.5, name: '其他', itemStyle: { color: '#ff8c00' } }
                ]
            }
        ]
    };
    pieChart.setOption(pieOption);

    // 响应窗口大小变化
    window.addEventListener('resize', function () {
        barChart.resize();
        lineChart.resize();
        pieChart.resize();
        if (myChart) myChart.resize();
    });
}

// 显示百度地图
function showBaiduMap(province) {
    const center = provinceCenters[province];
    if (!center) return;
    const info = cuisineData[province];
    if (!info) return;
    console.log(info.cuisine);

    document.getElementById('chinaMap').style.display = 'none';
    document.getElementById('baiduMapContainer').style.display = 'block';
    document.getElementById('backButton').style.display = 'block';


    baiduMap = new BMapGL.Map('baiduMapContainer');
    const point = new BMapGL.Point(center[0], center[1]);
    baiduMap.centerAndZoom(point, 10);
    baiduMap.addControl(new BMapGL.NavigationControl());

    // 创建 LocalSearch 对象
    const local = new BMapGL.LocalSearch(baiduMap, {
        renderOptions: { map: baiduMap },
        onSearchComplete: function(results) {
            if (local.getStatus() === BMAP_STATUS_SUCCESS) {
                // 处理搜索结果
                for (let i = 0; i < results.getCurrentNumPois(); i++) {
                    const poi = results.getPoi(i);
                    // 创建标注
                    const marker = new BMapGL.Marker(poi.point);
                    baiduMap.addOverlay(marker);

                    // 创建信息窗口
                    const infoWindow = new BMapGL.InfoWindow(`<p>${poi.title}</p><p>${poi.address}</p>`);
                    // 为标注添加点击事件，点击显示信息窗口
                    marker.addEventListener('click', function() {
                        this.openInfoWindow(infoWindow);
                    });
                }
            }
        }
    });

    // 执行搜索，这里搜索较有名的饭店，可根据实际情况修改关键词
    local.search(info.cuisine+'知名饭店');
}

// 显示原有地图
function showOriginalMap() {
    document.getElementById('baiduMapContainer').style.display = 'none';
    document.getElementById('backButton').style.display = 'none';
    document.getElementById('chinaMap').style.display = 'block';
}

// 事件监听
closeLeft.addEventListener('click', closeInfoBoxes);
closeRight.addEventListener('click', closeInfoBoxes);
mask.addEventListener('click', closeInfoBoxes);

// 页面加载完成后初始化
window.onload = function () {
    initMap();
    initCharts();
};
